package com.example.administrator.yunniuusedcar.mineModular;

import android.Manifest;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.net.Uri;
import android.support.v4.app.ActivityCompat;
import android.view.View;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.example.administrator.common.base.BaseActivity;
import com.example.administrator.yunniuusedcar.R;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.OnClick;

public class YuYueActivity extends BaseActivity {

    @BindView(R.id.iv_back)
    ImageView ivBack;
    @BindView(R.id.tv_mienYuYue)
    TextView tvMienYuYue;
    @BindView(R.id.LL_title)
    RelativeLayout LLTitle;
    @BindView(R.id.tv_YuYueName)
    EditText tvYuYueName;
    @BindView(R.id.tv_YuYueOrder)
    EditText tvYuYueOrder;
    @BindView(R.id.tv_BoHao)
    TextView tvBoHao;
    @BindView(R.id.Rl_CallTelep)
    RelativeLayout RlCallTelep;
    @BindView(R.id.btnError)
    TextView btnError;
    @BindView(R.id.Rl_HuiYuanZuanXian)
    RelativeLayout RlHuiYuanZuanXian;


    @OnClick({R.id.iv_back, R.id.tv_YuYueName, R.id.Rl_CallTelep, R.id.Rl_HuiYuanZuanXian})
    public void onViewClicked(View view) {
        switch (view.getId()) {
            case R.id.iv_back:
                initBacked();
                break;
            case R.id.tv_YuYueName:
                break;
            case R.id.Rl_CallTelep:   //拨号预约asd
                initTell();
                break;
            case R.id.Rl_HuiYuanZuanXian:  // vip会员专线
                initTell();
                break;
        }
    }

    private void initTell() {
        Intent j = new Intent(Intent.ACTION_CALL, Uri.parse("tel:4006993383"));
        if (ActivityCompat.checkSelfPermission(this, Manifest.permission.CALL_PHONE) != PackageManager.PERMISSION_GRANTED) {
            // TODO: Consider calling
            //    ActivityCompat#requestPermissions
            // here to request the missing permissions, and then overriding
            //   public void onRequestPermissionsResult(int requestCode, String[] permissions,
            //                                          int[] grantResults)
            // to handle the case where the user grants the permission. See the documentation
            // for ActivityCompat#requestPermissions for more details.
            return;
        }
        startActivity(j);
    }

    private void initBacked() {
        ivBack.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                finish();
            }
        });
    }

    @Override
    public int getLayoutRes() {
        return R.layout.activity_yu_yue;
    }

    @Override
    public void initView() {
        ButterKnife.bind(this);
    }

    @Override
    public void initListener() {

    }

    @Override
    public void initData() {

    }
}
